<?php
/**
 * 店铺设置
 */
namespace Member\Controller;
class StoreController extends CommonController {
    public function _initialize(){
        parent::_initialize();
        $this->is_login();
    }

    public function index(){
        if($_POST){
            $data = $_POST['data'];
            $data['info'] = strip_tags($data['info']);
            $res = M('store')->where(array('user_id'=>$this->user['id']))->save($data);
            if($res){
                $this->success('店铺信息编辑成功');
            }else{
                $this->error('店铺信息编辑失败');
            }
        }else{
            $info = M('store')->where(array('user_id'=>$this->user['id']))->find();
            if(!$info){
                M('store')->add(array('user_id'=>$this->user['id'],'name'=>$this->user['username']));
            }
            $this->info = M('store')->where(array('user_id'=>$this->user['id']))->find();
            $this->seoKey(array('seo_title'=>'店铺设置'));
            $this->display();
        }
    }







}